package com.gxuwz.leave.service;

import com.gxuwz.leave.dao.ClassDao;
import com.gxuwz.leave.entity.Class;

import java.util.List;

public class ClassServiceImpl implements ClassService{
    private ClassDao classDao;

    @Override
    public void addClass(Class entity) {
        classDao.insert(entity);
    }

    @Override
    public Class findClass(String classID) {
        Class clas = new Class();
        clas.setClassID(classID);
        List<Class> classes = classDao.query(clas);
        if(classes!=null){
            clas = classes.get(0);
        }
        return clas;
    }

    @Override
    public void deleteClass(String classID) {
        classDao.delete(classID);
    }

    @Override
    public List<Class> list(Class entity) {
        return classDao.query(entity);
    }

    @Override
    public void editClass(Class entity) {
        classDao.update(entity);
    }

    public void setClassDao(ClassDao classDao) {
        this.classDao = classDao;
    }
}
